package edu.sctu.java.consumer.case2;

import lombok.Data;

import java.util.function.Consumer;

@Data
public class Generator {

    private ConfigA.Builder configABuilder;
    private ConfigB.Builder configBBuilder;
    private ConfigC.Builder configCBuilder;

    public Generator() {
        this.configABuilder = new ConfigA.Builder();
        this.configBBuilder = new ConfigB.Builder();
        this.configCBuilder = new ConfigC.Builder();
    }

    // 本地的configA对象接受由consumer的方式进行配置
    public Generator configA(Consumer<ConfigA.Builder> consumer) {
        consumer.accept(configABuilder);
        return this;
    }

    public Generator configB(Consumer<ConfigB.Builder> consumer) {
        consumer.accept(configBBuilder);
        return this;
    }

    public Generator configC(Consumer<ConfigC.Builder> consumer) {
        consumer.accept(configCBuilder);
        return this;
    }


}
